package com.liit.module.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liit.module.dao.RoleDao;
import com.liit.module.entity.Role;
import com.liit.module.frame.utils.page.Pagination;
import com.liit.module.service.RoleService;

/**
 * @author dingweibo
 * @Title: RoleServiceImpl.java
 * @Description: TODO(用一句话描述该文件做什么)
 * @date 2015年11月28日
 */
@Service("roleService")
public class RoleServiceImpl implements RoleService {
	@Autowired
	private RoleDao roleDao;

	@Override
	public Integer saveRole(Role entity) throws Exception {
		return roleDao.saveRole(entity);
	}

	@Override
	public Integer updateRoleById(Role entity) throws Exception {
		return roleDao.updateRoleById(entity);
	}

	@Override
	public Role selectRoleById(Object id) throws Exception {
		return roleDao.selectRoleById(id);
	}

	@Override
	public Map<String, Object> listPage(Role role, Pagination pagination) {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("list", roleDao.listPage(role, pagination));
		result.put("page", pagination);
		return result;
	}

	@Override
	public Integer delPermBYId(Long id) {
		return roleDao.delPermBYId(id);
	}

	@Override
	public Integer bathSavePerm(Long[] rid, Long id) {
		return roleDao.bathSavePerm(rid, id);
	}

	@Override
	public List<Role> findByAccountId(Long id) {
		return roleDao.findByAccountId(id);
	}

	@Override
	public Integer delRoleBYId(Long id) {
		return roleDao.delRoleBYId(id);
	}

	@Override
	public Integer bathSaveRole(Long[] rid, Long id) {
		return roleDao.bathSaveRole(rid, id);
	}

}
